﻿package mortal.game.view.flowerSend.effect
{
    import flash.events.*;
    import flash.geom.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;

    public class FlowerSendSmallWin extends Window
    {
        public var recieveSp:FlowerPlayer;
        public var sendSp:FlowerPlayer;
        private var _rect3d:Rect3DObject;

        public function FlowerSendSmallWin()
        {
            super(LayerManager.uiLayer);
            return;
        }// end function

        override protected function addCloseButton() : void
        {
            return;
        }// end function

        override protected function setTitleSprite(param1:Number, param2:Number) : void
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._rect3d = Rect3DManager.instance.registerWindow(false, new Rectangle(0, 0, 10, 10), this);
            this.recieveSp = new FlowerPlayer(this._rect3d, this.contentTopOf3DSprite);
            this.sendSp = new FlowerPlayer(this._rect3d, this.contentTopOf3DSprite);
            this.recieveSp.createDisposedChildrenImpl();
            this.sendSp.createDisposedChildrenImpl();
            this.recieveSp.setWinType(FlowerPlayer.receive);
            this.sendSp.setWinType(FlowerPlayer.send);
            this.sendSp.addEventListener(Event.COMPLETE, this.bgCompl);
            this.recieveSp.addEventListener(Event.COMPLETE, this.bgCompl);
            this.bgCompl(null);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this.recieveSp.disposeImpl(param1);
            this.sendSp.disposeImpl(param1);
            this.recieveSp.removeEventListener(Event.COMPLETE, this.bgCompl);
            this.sendSp.removeEventListener(Event.COMPLETE, this.bgCompl);
            this.recieveSp = null;
            this.sendSp = null;
            if (this._rect3d)
            {
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

        protected function bgCompl(event:Event) : void
        {
            if (this.recieveSp.loaded && this.sendSp.loaded)
            {
                Rect3DManager.instance.windowShowHander(null, this);
                this.dispatchEvent(new Event(Event.COMPLETE));
            }
            return;
        }// end function

        public function get rect3d() : Rect3DObject
        {
            return this._rect3d;
        }// end function

    }
}
